/* http.ServerResponse对象的close事件的使用示例 */


var http = require('http');

var server = http.createServer(function(req, res){

	if(req.url !== '/favicon.ico'){
		res.on('close', function(){
			console.log('连接中断。');
		})

		setTimeout(function(){
			res.setHeader('Content-Type', 'text/plain');
			res.write('<html><head><meta charset="utf8"/></head>');
			res.write("你好");
			res.end();
		}, 5000);
	}


}).listen(1337, 'localhost');
